﻿//利用协程制作一个计秒器
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson14_code1 : MonoBehaviour
{
    public int timeIndex = 0;
    IEnumerator MyCoroutine()
    {
        while (true)
        {
            timeIndex++;
            yield return new WaitForSeconds(1f);
        }
    }
    void Start()
    {
        StartCoroutine(MyCoroutine());
    }

    // Update is called once per frame
    void Update()
    {
        Debug.LogFormat("timeIndex:{0}", timeIndex);
    }
}
